package day06;
/*猜数字的小游戏
    训练目标:while(true)自造死循环+break
 */

import java.util.Random;
import java.util.Scanner;

public class Guessing {
    public static void main(String[] args) {
        Random ran = new Random();
        int num = ran.nextInt(1000)+1;
        System.out.println(num);
        Scanner Sc = new Scanner(System.in);

        while (true){
            System.out.println("猜吧");
            int sc = Sc.nextInt();
            if (sc>num){
                System.out.println("猜大了");
            } else if (sc<num) {
                System.out.println("猜小了");
            }else {
                System.out.println("恭喜你.猜对了");
                break;
            }
        }

    }
}
